import { defHttp } from '@/utils/http/axios'

enum Api {
  ADD_FILE = '/file/add',
  UPLOAD_FILE = '/file/upload',
  DOWNLOAD_FILE = '/file/download',
  FILE_INFO = '/file/info',
  uploadJSON ='/file/uploadJson',
  getJSON = '/file/getJson',
}

export const addFile = (data) => defHttp.post({ url: Api.ADD_FILE, data })
export const uploadFile = (config, data) => defHttp.uploadFile({ url: Api.UPLOAD_FILE, ...config }, data);
export const fileDownload = (params) => defHttp.get({ url: Api.DOWNLOAD_FILE, params, responseType: 'blob' });
export const getFileInfo = (params) => defHttp.get({ url: Api.FILE_INFO, params });
export const uploadJSON = (data) => defHttp.post({url: Api.uploadJSON,headers: {
  "Content-Type": 'multipart/form-data'
}, data});
export const getJSON = (data) => defHttp.post({ url: Api.getJSON, data});

